<?php
	$brand_id = $params[0];
	list($sql,$all_page) = splitPage("`v_product`","1 AND `brand_id` = '$brand_id' AND `status` != '2' ORDER BY `product_id` ASC", 30, $_GET['p']);
	$strPage = fetchPage($all_page,$_GET['p']);
	$query = mysql_query($sql);

	$tp->block('result');
	while($result = mysql_fetch_assoc($query)) {
		$product_id	= $result['product_id'];
		$title		= $result['title'];
		$brand_thumb= $result['brand_thumb'] ? " <img src=\"/thumb/100/30/zc/contents/brand/{$result['brand_thumb']}\" />" : '';
		$status		= $result['onsale'];
		/*if($status){
			$disclass	= "<a href=\"undiscount/$product_id\" class=\"undiscount tooltip\">Discount<em>Discount</em></a>";
			$status		= '<span style="color:#F30">code discount</span>';
		}else{
			$disclass	= "<a href=\"discount/$product_id\" class=\"discount tooltip\">Discount<em>Discount</em></a>";
			$status		= 'standard';
		}*/

		$status	= 'standard';
		$sql2	= "SELECT `product_id` FROM `tbl_product_discount` WHERE `product_id` = '$product_id'  LIMIT 1";
		$query2	= mysql_query($sql2);
		if(mysql_num_rows($query2)) {
			$status		= '<span style="color:#F30">code discount</span>';
		}
		mysql_free_result($query2);
		
		
		$date		= formatDate($result['date'], 'd/m/Y');
		$n++;
		$tp->apply();
	}
	mysql_free_result($query);
?>